package TestDemo.example.controller;

import TestDemo.example.pojo.ClazzOption;
import TestDemo.example.pojo.JobOption;
import TestDemo.example.pojo.Result;
import TestDemo.example.service.EmpService;
import TestDemo.example.service.StudentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Slf4j

@RestController
@RequestMapping(value = "/report")
public class ReportController {
    @Autowired
    private EmpService empServiceImpl;
    @Autowired
    private StudentService ServiceImpl;
    @GetMapping("/empJobData")
    public Result empJobData() {
        JobOption jobOption =empServiceImpl.getEmpJobData();
        return Result.success(jobOption);
    }

    @GetMapping ("/empGenderData")
    public Result empGenderData() {
        log.info("查询员工性别数据");
        List<Map<String,Object>> empGenderData =empServiceImpl.getEmpGenderData();
        return Result.success(empGenderData);
    }

    @GetMapping("/studentDegreeData")
    public Result studentDegreeDate() {
        log.info("查询学生学历数据");
        ArrayList<Map<String,Object>> studentDegreeData =ServiceImpl.getStudentDegreeData();
        return Result.success(studentDegreeData);
    }

    @GetMapping("/studentCountData")
    public Result studentCountData() {
        log.info("查询学生数量数据");
        ClazzOption studentCount =ServiceImpl.getStudentCount();
        return Result.success(studentCount);
    }
}
